import {
  AllowNull,
  AutoIncrement,
  Column,
  DataType,
  ForeignKey,
  Model,
  PrimaryKey,
  Table,
} from 'sequelize-typescript';
import { Resume } from './resume.model';

@Table({
  tableName: 'customization',
})
export class Customization extends Model {
  @PrimaryKey
  @AutoIncrement
  @Column({
    type: DataType.INTEGER,
    allowNull: false,
    comment: '',
  })
  id: string;

  @ForeignKey(() => Resume)
  @AllowNull(false)
  @Column({
    type: DataType.INTEGER,
    comment: '',
  })
  resumeId: number;

  //用户id
  @Column({
    type: DataType.INTEGER,
    comment: 'userId',
  })
  userId: number;

  @Column({
    type: DataType.JSON,
    comment: '',
  })
  header: JSON;

  @Column({
    type: DataType.JSON,
    comment: '',
  })
  layout: JSON;

  @Column({
    type: DataType.JSON,
    comment: '',
  })
  sectionOrder: JSON;

  // @Column({
  //   type: DataType.JSON,
  //   comment: '',
  // })
  // defaultSectionOrder: JSON;

  @Column({
    type: DataType.JSON,
    comment: '',
  })
  spacing: JSON;

  @Column({
    type: DataType.JSON,
    comment: '',
  })
  colors: JSON;

  @Column({
    type: DataType.JSON,
    comment: '',
  })
  applyAccentColor: JSON;

  @Column({
    type: DataType.STRING(20),
    comment: '',
  })
  template: string;

  @Column({
    type: DataType.INTEGER,
    comment: '',
  })
  templateId: number;

  @Column({
    type: DataType.JSON,
    comment: '',
  })
  title: JSON;
}
